package threading;
import java.util.UUID;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: qian
 * Date: 2022-12-29
 * Time: 14:51
 */
public class Demo8 {
    public static void main1(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
            for(int i=0;i<5;i++){
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        t.start();

        System.out.println("main线程执行join之前");
        t.join(1000);
        System.out.println("main线程执行join之后");
        System.out.println("hello main");
        Thread.sleep(1000);
    }
}
